/**
 * 
 */
package fecat.ui.option;

import java.awt.Color;

import fecat.services.log.LoggingService;
import fecat.services.property.Properties;
import fecat.services.property.PropertyService;
import fecat.services.resource.ResourceService;
import fecat.util.SwingResourceManager;

/**
 * @author sky
 *
 */
public class AdvanceQuoteStylePanel extends StyleOptionPanel {

	private static final long serialVersionUID = -5384045189297145179L;
//	private String rateColorText;
//	private Properties rateProperty;
	private String unchangeColorText;
	private Properties unchangeProperty;
	private String decreasingColorText;
	private Properties decreasingProperty;
	private String increasingColorText;
	private Properties increasingProperty;
//	private String expiredText;
//	private Properties expiredProperty;
//	private String indicativeText;
//	private Properties indicativeProperty;
//	private String unavailableText;
//	private Properties unavailableProperty;
	public AdvanceQuoteStylePanel(){
		Properties quoteProperty=(Properties)PropertyService.getUserProperties("Quote");
		if(quoteProperty==null)
			return;
		Properties advancedProperty=(Properties)quoteProperty.get("Advanced");
		if(advancedProperty==null)
			return;
//		rateColorText=ResourceService.getString("Option.Advanced.RateTextColor");
//		rateProperty=(Properties)advancedProperty.get("RateTextColor");
//		int r=rateProperty.getInt("R");
//		int g=rateProperty.getInt("G");
//		int b=rateProperty.getInt("B");
//		this.setProperty(rateColorText,SwingResourceManager.getColor(r,g,b));
		unchangeColorText=ResourceService.getString("Option.Advanced.UnchangedRateTextColor");
		unchangeProperty=(Properties)advancedProperty.get("UnchangedRateTextColor");
		int r=unchangeProperty.getInt("R");
		int g=unchangeProperty.getInt("G");
		int b=unchangeProperty.getInt("B");
		this.setProperty(unchangeColorText,SwingResourceManager.getColor(r,g,b));
		decreasingColorText=ResourceService.getString("Option.Advanced.DecreasingRateTextColor");
		decreasingProperty=(Properties)advancedProperty.get("DecreasingRateTextColor");
		r=decreasingProperty.getInt("R");
		g=decreasingProperty.getInt("G");
		b=decreasingProperty.getInt("B");
		this.setProperty(decreasingColorText,SwingResourceManager.getColor(r,g,b));
		increasingColorText=ResourceService.getString("Option.Advanced.IncreasingRateTextColor");
		increasingProperty=(Properties)advancedProperty.get("IncreasingRateTextColor");
		r=increasingProperty.getInt("R");
		g=increasingProperty.getInt("G");
		b=increasingProperty.getInt("B");
		this.setProperty(increasingColorText,SwingResourceManager.getColor(r,g,b));
//		expiredText=ResourceService.getString("Option.Advanced.ExpiredRateTextColor");
//		expiredProperty=(Properties)advancedProperty.get("ExpiredRateTextColor");
//		r=expiredProperty.getInt("R");
//		g=expiredProperty.getInt("G");
//		b=expiredProperty.getInt("B");
//		this.setProperty(expiredText,SwingResourceManager.getColor(r,g,b));
//		indicativeText=ResourceService.getString("Option.Advanced.IndicativeRateTextColor");
//		indicativeProperty=(Properties)advancedProperty.get("IndicativeRateTextColor");
//		r=indicativeProperty.getInt("R");
//		g=indicativeProperty.getInt("G");
//		b=indicativeProperty.getInt("B");
//		this.setProperty(indicativeText,SwingResourceManager.getColor(r,g,b));
//		unavailableText=ResourceService.getString("Option.Advanced.UnavailableRateTextColor");
//		unavailableProperty=(Properties)advancedProperty.get("UnavailableRateTextColor");
//		r=unavailableProperty.getInt("R");
//		g=unavailableProperty.getInt("G");
//		b=unavailableProperty.getInt("B");
//		this.setProperty(unavailableText,SwingResourceManager.getColor(r,g,b));
	}

	public void saveProperties(){
		try{
//			Color rateColor=(Color)this.getProperty(rateColorText);
//			this.rateProperty.set("R",rateColor.getRed());
//			this.rateProperty.set("G",rateColor.getGreen());
//			this.rateProperty.set("B",rateColor.getBlue());
			Color unchangeColor=(Color)this.getProperty(unchangeColorText);
			this.unchangeProperty.set("R",unchangeColor.getRed());
			this.unchangeProperty.set("G",unchangeColor.getGreen());
			this.unchangeProperty.set("B",unchangeColor.getBlue());
			Color decreasingColor=(Color)this.getProperty(this.decreasingColorText);
			this.decreasingProperty.set("R",decreasingColor.getRed());
			this.decreasingProperty.set("G",decreasingColor.getGreen());
			this.decreasingProperty.set("B",decreasingColor.getBlue());
//			Color expiredColor=(Color)this.getProperty(expiredText);
//			this.expiredProperty.set("R",expiredColor.getRed());
//			this.expiredProperty.set("G",expiredColor.getGreen());
//			this.expiredProperty.set("B",expiredColor.getBlue());
//			Color indicativeColor=(Color)this.getProperty(indicativeText);
//			this.indicativeProperty.set("R",indicativeColor.getRed());
//			this.indicativeProperty.set("G",indicativeColor.getGreen());
//			this.indicativeProperty.set("B",indicativeColor.getBlue());
//			Color unavailableColor=(Color)this.getProperty(unavailableText);
//			this.unavailableProperty.set("R",indicativeColor.getRed());
//			this.unavailableProperty.set("G",unavailableColor.getGreen());
//			this.unavailableProperty.set("B",unavailableColor.getBlue());
			Color increasingColor=(Color)this.getProperty(this.increasingColorText);
			this.increasingProperty.set("R",increasingColor.getRed());
			this.increasingProperty.set("G",increasingColor.getGreen());
			this.increasingProperty.set("B",increasingColor.getBlue());
		}
		catch(Exception ex){
			LoggingService.error(ex);
		}
		
		
	}
}
